/*
 ============================================================================
 Name		: FlashLightContainer.h
 Author	  : 
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CFlashLightContainer declaration
 ============================================================================
 */

#ifndef FLASHLIGHTCONTAINER_H
#define FLASHLIGHTCONTAINER_H

// INCLUDES
#include <coecntrl.h>

#include <HWRMLight.h>
#include "TimeOutNotifier.h"
#include "LMDebug.h"

// CLASS DECLARATION
class CTimeOutTimer;

/**
 *  CFlashLightContainer
 * 
 */
class CFlashLightContainer : public CCoeControl, MCoeControlObserver, 
							MHWRMLightObserver,MTimeOutNotifier
	{
public:
	enum TStrLightState
		{
		EStrLightOn = 0,
		EStrLightOff
		};
//private:
//	enum
//	{
//	EVibraStateUnKnown = 0,
//	EVibraStateRunning,
//	EVibraStateStopped
//	};	
	
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~CFlashLightContainer();

	/**
	 * Two-phased constructor.
	 */
	static CFlashLightContainer* NewL(const TRect& aRect);

	/**
	 * Two-phased constructor.
	 */
	static CFlashLightContainer* NewLC(const TRect& aRect);

private:

	/**
	 * Constructor for performing 1st stage construction
	 */
	CFlashLightContainer();

	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL(const TRect& aRect);

public:
	// Functions from base classes
	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);

private:
	// Functions from base classes
	void SizeChanged();
	TInt CountComponentControls() const;
	CCoeControl* ComponentControl(TInt aIndex) const;
	void Draw(const TRect& aRect) const;
	void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
	void HandlePointerEventL( const TPointerEvent& aEvent );
	void HandleResourceChange( TInt aType );
	
    // from MHWRMLightObserver
    virtual void LightStatusChanged(TInt aTarget, 
                                    CHWRMLight::TLightStatus aStatus);
    
    virtual void TimerExpired();
    
public:
	void Light();
	
	void LightOn();
	void LightOff();
	
private:
	void ResetColor();

private:
	//data
	CHWRMLight*     iLight;
	TStrLightState	iLightState;
//	TInt 			iVibraState;
	
	CTimeOutTimer* 	iTimer;
	
	TRgb 			iColor;
	TInt 			iColorIndex;
	TInt 			iOnDuration;
	TInt 			iOffDuration;
	
	CFbsBitmap* 	iImgLight;
	CFbsBitmap*  	iImgLightGray;
	CFbsBitmap* 	iImgLightMask;
	
	};

#endif // FLASHLIGHTCONTAINER_H
